import request from '@/utils/request.js';

const deviceApi = {
    /**
     * 获取设备列表
     * @param {*} params 
     */
    getDevices(params) {
        return request.get('api/devices/person-position-devices/list',{params});
    },
    getBaseConfig(id) {
        return request.get('api/devices/'+id+'/baseConfig');
    },
    getNetConfig(id) {
        return request.get('api/devices/'+id+'/networkParams');
    },
    getPortConfig(id,portIndex) {
        return request.get('api/devices/'+id+'/port'+portIndex);
    },
    updateDeviceConfig(deviceId,params) {
        return request.put('api/devices/'+deviceId+'/baseConfig',params);
    },
    updateNetConfig(deviceId,params) {
        return request.put('api/devices/'+deviceId+'/networkParams',params);
    },
    updatePortConfig(deviceId,portIndex,params) {
        return request.put('api/devices/'+deviceId+'/port'+portIndex,params);
    },
    reboot(deviceCode) {
        return request.get('api/devices/'+deviceCode+'/reset');
    },

    /**
     * 获取设备统计
     * @param {} params 
     */
    getDeviceStatistics(params) {
        return request.get('api/devices-count',{params});
    },
}
export default deviceApi;